home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -screenplay- / hd_installers / -whdload- / whdload_dev / src / slave-examples / 9finger.asm next >
Assembly Source File  |  1998-06-22  |  4KB  |  200 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Program.    9finger.asm
  3. ;  :Contents.    Slave for "9 finger's" from Spaceballs
  4. ;  :Author.    WEPL
  5. ;  :History.    13.11.96 - 24.11.96
  6. ;        28.11.96 trackloader delay changed ('60)
  7. ;        16.06.97 soundtracker playback fixed
  8. ;             slave version 2
  9. ;        21.06.97 rts on stfix added
  10. ;        24.06.97 keyboard routine fixed
  11. ;        15.08.97 update for key managment
  12. ;        30.08.97 keyboard external
  13. ;  :Requires.    -
  14. ;  :Copyright.    Public Domain
  15. ;  :Language.    68000 Assembler
  16. ;  :Translator.    Barfly V1.131
  17. ;  :To Do.
  18. ;---------------------------------------------------------------------------*
  19.  
  20.     INCDIR    Includes:
  21.     INCLUDE    whdload.i
  22.  
  23.     OUTPUT    "dwart:9 finger's/9finger.slave"
  24.     BOPT    O+ OG+            ;enable optimizing
  25.     BOPT    w4-            ;disable 64k warnings
  26.     SUPER
  27.  
  28. ;======================================================================
  29.  
  30. .base        SLAVE_HEADER        ;ws_Security + ws_ID
  31.         dc.w    4        ;ws_Version
  32.         dc.w    WHDLF_Disk|WHDLF_NoError ;ws_flags
  33.         dc.l    $fb000        ;ws_BaseMemSize
  34.         dc.l    $400        ;ws_ExecInstall
  35.         dc.w    _Start-.base    ;ws_GameLoader
  36.         dc.w    0        ;ws_CurrentDir
  37.         dc.w    0        ;ws_DontCache
  38. _keydebug    dc.b    $58        ;ws_keydebug = F9
  39. _keyexit    dc.b    $59        ;ws_keyexit = F10
  40.  
  41. ;======================================================================
  42.  
  43.     DOSCMD    "WDate >T:date"
  44.         dc.b    "$VER: "
  45.     INCBIN    "T:date"
  46.         dc.b    0,0
  47.  
  48. ;======================================================================
  49. _Start    ;    A0 = resident loader
  50. ;======================================================================
  51.  
  52.         lea    (_resload,pc),a1
  53.         move.l    a0,(a1)            ;save for later use
  54.         
  55.         move.l    #CACRF_EnableI,d0    ;enable instruction cache
  56.         move.l    d0,d1            ;mask
  57.         jsr    (resload_SetCACR,a0)
  58.  
  59.     ;install keyboard quitter
  60.         bsr    _SetupKeyboard
  61.  
  62.  IFEQ 1
  63.     ;bootblock
  64.         lea    $1000,a6        ;A6 bootblock address
  65.         
  66.         moveq    #0,d0            ;offset
  67.         move.l    #2*512,d1        ;size
  68.         moveq    #1,d2            ;disk
  69.         lea    -12(a6),a0
  70.         bsr    _LoadDisk
  71.         
  72.         moveq    #0,d0
  73.         lea    $80000,a0
  74.  
  75.         nops    2,$3e(a6)        ;exp mem check
  76.         
  77.         patch    $198(a6),_trackload
  78.         patch    $150(a6),_trackload_bad
  79.         
  80.         patch    $148(a6),_1
  81.         jmp    $26(a6)
  82.  ENDC
  83.  
  84. ;---------------
  85.  
  86. _start        lea    $80000,a6        ;exp mem
  87.         
  88.         move.l    a6,a0
  89.         moveq    #1,d0
  90.         moveq    #16,d1
  91.         bsr    _trackload
  92.         
  93.         lea    $7fff0,a0
  94.         move.l    a6,(a0)+        ;exp mem
  95.         clr.l    (a0)+            ;???
  96.         move.w    #-1,(a0)+        ;???
  97.         
  98.         lea    $1e00,a7
  99.         
  100. ;---------------
  101.  
  102. _1        jsr    $80008            ;decrunch
  103.         lea    $2000,a6        ;address of main exe
  104.  
  105.     ;fix soundtracker playback
  106.         move.l    a6,a0
  107.         move.l    a6,a1
  108.         add.l    #11*512*16,a1
  109.         bsr    _stfix
  110.  
  111.         and.w    #~INTF_PORTS,$38b6(a6)    ;preserve int on
  112.  
  113.         patch    $5f8(a6),_trackload    ;loader
  114.         patch    $4f2(a6),_disk2        ;disk 2 check and wait
  115.         patch    $430(a6),_restart
  116.  
  117.     ;    bsr    waitvb
  118.     ;    move.w    #$8000,_custom+vposw    ;force LOF
  119.  
  120.         jmp    (a6)
  121.  
  122. _restart    lea    _disk,a0
  123.         subq.w    #1,(a0)
  124.         move.w    #$7fff-INTF_PORTS,_custom+intena
  125.         move.w    #4*50,d0        ;wait n secs
  126. .w        bsr    _waitvb
  127.         dbf    d0,.w
  128.     ;    move.w    #$000,_custom+vposw    ;set LOF
  129.         bra    _start
  130.  
  131. ;---------------
  132.  
  133. _disk2        lea    _disk,a0
  134.         addq.w    #1,(a0)
  135.         rts
  136.  
  137. _disk        dc.w    1
  138.  
  139. ;---------------
  140. ;    d0 = starttrack
  141. ;    d1 = amount tracks
  142. ;    a0 = address
  143.  
  144. ;_trackload_bad    addq.w    #1,d1
  145.  
  146. _trackload    mulu    #11*512,d0        ;offset
  147.         mulu    #11*512,d1        ;size
  148.         move.w    (_disk),d2
  149.  
  150.         cmp.l    #200000,d1
  151.         blo    .2
  152.         lsr.l    #1,d1
  153.         movem.l    d0-d1/a0-a2,-(a7)
  154.         move.l    (_resload),a2
  155.         jsr    (resload_DiskLoad,a2)
  156.         movem.l    (a7)+,d0-d1/a0-a2
  157.         add.l    d1,d0            ;new offset
  158.         add.l    d1,a0            ;new address
  159.  
  160.         move.l    d1,d3
  161.         divu    #11*512/18,d3        ;wait ca. 18/50 secs per track
  162. .w        bsr    _waitvb
  163.         dbf    d3,.w
  164.  
  165. .2        movem.l    d0-d1/a0-a2,-(a7)
  166.         move.l    (_resload),a2
  167.         jsr    (resload_DiskLoad,a2)
  168.         movem.l    (a7)+,d0-d1/a0-a2
  169.         add.l    d1,a0
  170.         
  171.         rts
  172.  
  173. ;--------------------------------
  174.  
  175. _waitvb        waitvb
  176.         rts
  177.  
  178. ;--------------------------------
  179.  
  180. _resload    dc.l    0        ;address of resident loader
  181.  
  182. ;--------------------------------
  183.  
  184. _exit        pea    TDREASON_OK.w
  185.         bra    _end
  186. _debug        pea    TDREASON_DEBUG.w
  187. _end        move.l    (_resload),-(a7)
  188.         add.l    #resload_Abort,(a7)
  189.         rts
  190.  
  191. ;======================================================================
  192.  
  193.     INCDIR    Sources:whdload
  194.     INCLUDE    keyboard.s
  195.     INCLUDE    stfix.s
  196.  
  197. ;======================================================================
  198.  
  199.     END
  200.